cmake_minimum_required(VERSION 3.10)
project(library)

SET( CMAKE_VERBOSE_MAKEFILE on )

#set(CMAKE_CXX_FLAGS "-fexceptions")
#set(CMAKE_CXX_FLAGS_DEBUG -fexceptions)
add_definitions("-DBUILD_DLL")
set(CMAKE_CXX_STANDARD 17)
message(status ${CMAKE_BUILD_WITH_INSTALL_NAME_DIR})
message(status "CMAKE_BUILD_TYPE:${CMAKE_BUILD_TYPE}")
file(GLOB_RECURSE library_source_files "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp")
file(GLOB library_header_files "${CMAKE_CURRENT_SOURCE_DIR}/*.h")

#set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)

add_library(library SHARED ${library_source_files} ${library_header_files})

set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR}/../libs)
message(status ${CMAKE_INSTALL_PREFIX})
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_INSTALL_PREFIX}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_INSTALL_PREFIX}/../bin)
#add_compile_options(-std=c++11)
#set_target_properties(libhello PROPERTIES OUTPUT_NAME "hello")

install(FILES ${libraryy_header_files} DESTINATION ${CMAKE_INSTALL_PREFIX}/include)
install(FILES cmake-build-${CMAKE_BUILD_TYPE}/library.dll DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)